AllocationArray
Represents a dynamically resizing array allocation.
実装: IEnumerable<T>, IEnumerable
コンストラクター
public AllocationArray(int capacity)
allocationArray = AllocationArray(capacity)
Initializes a new instance of the AllocationArray class with the specified capacity.
- capacity
- The initial capacity of the array. Must be at least 1.
プロパティ
public int Count { get; set; }
value = allocationArray.Count
allocationArray.Count = value
Gets or sets the current number of elements in the array.
public T Item { get; set; }
value = allocationArray.Item
allocationArray.Item = value
Gets or sets the element at the specified index.
- index
- The zero-based index of the element to get or set.
戻り値: The element at the specified index.
public int MaxCount { get; set; }
value = allocationArray.MaxCount
allocationArray.MaxCount = value
Gets or sets the maximum allowed count of elements.
メソッド
public void Add(T item)
allocationArray.Add(item)
Adds an item to the end of the array.
- item
- The item to add.
public void Add(T[] items, int offset, int count)
allocationArray.Add(items, offset, count)
Adds a range of items from an array to the end of the allocation array.
- items
- The array of items to add.
- offset
- The zero-based index at which to start copying from the source array.
- count
- The number of items to copy.
private void EnsureCapacity(int newSize)
allocationArray.EnsureCapacity(newSize)
Ensures that the array has the specified new size capacity.
- newSize
- The required size.
public IEnumerator<T> GetEnumerator()
result = allocationArray.GetEnumerator()
Returns an enumerator that iterates through the collection.
戻り値: An enumerator for the allocation array.
public void RemoveAt(int index)
allocationArray.RemoveAt(index)
Removes the item at the specified index.
- index
- The zero-based index of the item to remove.
public void RemoveRange(int startIndex, int count)
allocationArray.RemoveRange(startIndex, count)
Removes a range of items from the array.
- startIndex
- The zero-based starting index of the range to remove.
- count
- The number of items to remove.
public void Reset(int capacity)
allocationArray.Reset(capacity)
Resets the array, clearing all elements and optionally resizing the buffer.
- capacity
- The desired capacity. Must be at least 1.
private void Resize(int capacity)
allocationArray.Resize(capacity)
Resizes the buffer array to the specified capacity.
- capacity
- The new capacity of the buffer.
System#Collections#IEnumerable#GetEnumerator()
Returns an enumerator that iterates through the collection.
戻り値: An enumerator for the allocation array.